<template>
  <div>
    <!-- <h3>当前最新的 count值为：{{ count }}</h3> -->
    <h3>{{ showNum }}</h3>
    <button @click="sub1">-1</button>
    <button @click="subN(7)">-n</button>
    <button @click="asyFn1">-1 async</button>
    <button @click="asyFn2">-5 async</button>
    <!-- <button @click="Asubn">-n async</button> -->
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions, mapGetters } from 'vuex'
export default {
  data() {
    return {}
  },
  computed: {
    ...mapState(['count']),
    ...mapGetters(['showNum'])
  },
  methods: {
    ...mapMutations(['sub1', 'subN']),
    ...mapActions(['AsyncSub1', 'AsyncSubN']),

    asyFn1() {
      this.$store.dispatch('AsyncSub1')
    },
    asyFn2() {
      this.$store.dispatch('AsyncSubN', 5)
    }
  }
}
</script>

<style></style>
